package com.poet.quick.ssh.dwr;

import java.util.List;

import javax.annotation.Resource;

import org.directwebremoting.annotations.RemoteMethod;
import org.directwebremoting.annotations.RemoteProxy;
import org.directwebremoting.spring.SpringCreator;

import com.alibaba.fastjson.JSON;
import com.poet.quick.ssh.entity.Grade;
import com.poet.quick.ssh.service.GradeService;

@RemoteProxy(name="gradeFunc",creator = SpringCreator.class)
public class GradeDwrService {

	@Resource
	private GradeService gradeService;
	
	@RemoteMethod()
	public Integer getGradeAccount(){
		return gradeService.findAll().size();
	}
	
	@RemoteMethod()
	public String allGrades(){
		List<Grade> gradeList = gradeService.findAll();
		return JSON.toJSONString(gradeList);
	}
	
	@RemoteMethod()
	public String helloWorld(String str){
		return "hello " + str;
	}
	
}
